<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>深度学习与PyTorch课程</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 0;
            padding: 0;
            background-color: #f4f4f9;
            display: flex;
            flex-direction: column;
            justify-content: flex-start;
            align-items: center;
            height: 100vh;
        }
        header {
            background-color: #333;
            color: white;
            text-align: center;
            padding: 20px 0;
            width: 100%;
            position: relative;
        }
        .auth-buttons {
            position: absolute;
            top: 50%;  /* 设置距离顶部50%的位置 */
            right: 20px;
            transform: translateY(-50%);  /* 调整位置使其完全居中 */
            display: flex;  /* 使用 flexbox 排列用户名和退出按钮 */
            align-items: center;  /* 垂直居中对齐 */
            justify-content: center;  /* 水平居中对齐 */
            gap: 10px;  /* 添加间距 */
        }
        .auth-buttons a, .auth-buttons button {
            color: white;
            text-decoration: none;
            margin: 0 10px;
            font-weight: bold;
            border: 1px solid white;
            padding: 5px 10px;
            border-radius: 5px;
            transition: background-color 0.3s, color 0.3s;
        }
        .auth-buttons button {
            color: black;  /* 设置退出按钮文字为黑色 */
            background-color: white;  /* 设置退出按钮背景为白色 */
        }
        .auth-buttons a:hover, .auth-buttons button:hover {
            background-color: white;
            color: #333;
        }
        .container {
            display: grid;
            grid-template-columns: 1fr;  /* 设置为单列 */
            gap: 20px;
            padding: 20px;
            width: 50%;  /* 调整按钮区域宽度 */
            margin-top: 20px;
        }
        .button {
            background-color: #4CAF50;
            color: white;
            padding: 20px;
            margin: 10px;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            width: 100%;  /* 按钮宽度占满容器 */
            text-align: center;
            transition: background-color 0.3s;
        }
        .button:hover {
            background-color: #45a049;
        }
        .button a {
            color: white;
            text-decoration: none;
            display: block;
        }
        .username {
            color: white;
            font-weight: bold;
            margin-top: 10px;
            margin: 0;  /* 移除默认margin */
            line-height: 1;  /* 调整行高 */
        }
        .logout-btn {
            padding: 5px 10px;
            line-height: 1;  /* 确保按钮文本垂直居中 */
            height: fit-content;  /* 调整按钮高度 */
            display: inline-flex;  /* 使用flex布局 */
            align-items: center;  /* 按钮内容垂直居中 */
        }
    </style>
</head>
<body>

<header>
    <h1>深度学习与PyTorch课程</h1>
    <p>选择一个算法案例以查看详细内容</p>

    <!-- 显示用户的用户名 -->
    <div class="auth-buttons">
        {% if username %}
            <span class="username">欢迎, {{ username }}</span>
            <!-- 退出按钮 -->
            <form method="POST" action="{% url 'logout' %}">
                {% csrf_token %}
                <button type="submit" class="logout-btn">退出</button>
            </form>
        {% else %}
            <a href="/register">注册</a>
            <a href="/login">登录</a>
        {% endif %}
    </div>
</header>

<div class="container">
    <button class="button">
        <a href="/titanic/">决策树算法案例</a>
    </button>
    <button class="button">
        <a href="/gpt/">ChatGPT应用案例</a>
    </button>
    <button class="button">线性回归算法案例</button>
    <button class="button">逻辑回归算法案例</button>
    <button class="button">KNN算法案例</button>
    <button class="button">神经网络算法案例</button>
    <button class="button">LeNet算法案例</button>
    <button class="button">AlexNet算法案例</button>
    <button class="button">VGGNet算法案例</button>
    <button class="button">InceptionNet算法案例</button>
    <button class="button">ResNet算法案例</button>
    <button class="button">CNN算法案例</button>
    <button class="button">RNN算法案例</button>
    <button class="button">LSTM算法案例</button>
    <button class="button">GRU算法案例</button>
    <button class="button">GAN算法案例</button>
    <button class="button">Transformer算法案例</button>
    <button class="button">KNN与CNN算法对比案例</button>
</div>

</body>
</html>
